package com.chilly.other.collection.map;

import java.util.Map;
import java.util.TreeMap;

/**
 * Created by Chilly Cui on 2020/12/15.
 */
public class TreeMapDemo {

    public static void main(String[] args) {
        Map<Object, String> sortedMap = new TreeMap<>();

        sortedMap.put(new Person("a", 21), "1");
        sortedMap.put(new Person("b", 23), "1");
        sortedMap.put(new Person("c", 22), "1");

        System.out.println(sortedMap);
        //{Person(name=a, age=21)=1, Person(name=c, age=22)=1, Person(name=b, age=23)=1}
    }
}
